﻿using FuelDXApplication1.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FuelDXApplication1.TmzWinform
{
    public partial class UserLogin : Form
    {
        public UserLogin()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonEdit1_Click(object sender, EventArgs e)
        {
            if (textEdit1.Text == "" || textEdit2.Text == "")
            {
                MessageBox.Show("用户名和密码不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var username=textEdit1.Text;
            var password=textEdit2.Text;
            var list = DBHelper.Query<Account>();
            var userName = list.Result[0].LoginName;
            var passWord = list.Result[0].LoginPwd;
            if (username == userName && password == passWord)
            {
                MessageBox.Show("登录成功");
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
            }
        }
    }
}
